package main

import (
	"log"
	"net/http"
	"time"
	"edgex-club/repository"
)

func main() {
	r := initRouter()

	b := repository.DBConnect()
	if b {
		log.Println("connect to db success!")
	} else {
		log.Println("failed connect to db!")
	}

	server := &http.Server{
		Handler:      GeneralFilter(r),
		Addr:         ":8080",
		WriteTimeout: 15 * time.Second,
		ReadTimeout:  15 * time.Second,
	}
	log.Println("Server Listen On Port: 8080")
	log.Fatal(server.ListenAndServe())
}
